/* 
 * File:   server.h
 * Author: onteria_
 *
 * Created on April 28, 2011, 12:44 PM
 */

#ifndef SERVER_H
#define	SERVER_H

#ifdef	__cplusplus
extern "C" {
#endif

	/* 	These are globals so that the signal handler
		can cleanup the servers */
	int server_ipv4;
	int server_ipv6;

    int miko_create_server(int port, const char * host, int max_connections, int ipv6);
    int miko_run_server(int server, void *(*handler)(void*), int ipv6);
    void *process_connection(void * socket);
    int miko_setup_server(int ipv6);
    void check_socket_error(int error_code, pthread_t thread, int file_descriptor);

#define MIKO_IPV4 0
#define MIKO_IPV6 1
#define MIKO_DUAL_IPV 2

#ifdef	__cplusplus
}
#endif

#endif	/* SERVER_H */

